<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:75:"D:\important\netwws-cms\public/../application/admin\view\article\lists.html";i:1507614517;s:76:"D:\important\netwws-cms\public/../application/admin\view\extends\extend.html";i:1507614517;}*/ ?>
<!DOCTYPE html>
<html>
<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <!--bootstarp-->
    <link href="__admin__/css/bootstrap.min.css" rel="stylesheet">
    <!-- 图标-->
    <link href="__admin__/css/font-awesome.min.css" rel="stylesheet">
    <!-- animate -->
    <link href="__admin__/css/animate.min.css" rel="stylesheet">
    <!--自定义css-->
    <link href="__admin__/css/style.min.css" rel="stylesheet">
    
    <!--美化 checkbox radio css-->
    <link href="__admin__/css/plugins/iCheck/custom.css" rel="stylesheet">

</head>
<body class="gray-bg">

    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>
                            <i class="glyphicon glyphicon-log-out"></i>
                            <?php if(is_array($parents) || $parents instanceof \think\Collection || $parents instanceof \think\Paginator): $i = 0; $__LIST__ = $parents;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                <a href="<?php echo $v['url']; ?>"><?php echo $v['name']; ?></a> <em class="glyphicon glyphicon-menu-right"></em>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                        </h5>
                        <div class="ibox-tools">
                            <a href="javascript:location.reload(true);" class="btn btn-outline btn-info btn-xs">
                                <i class="fa fa-refresh"></i> 刷新
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">
                        <?php if(!(empty($childColumn) || (($childColumn instanceof \think\Collection || $childColumn instanceof \think\Paginator ) && $childColumn->isEmpty()))): ?>
                            <div class="row">
                                <div class="col-sm-12">

                                    <div class="alert alert-warning">
                                         <h3 style="margin: 0;"><i class="glyphicon glyphicon-tasks"></i> 子栏目:</h3>
                                        <div class="hr-line-dashed" style="margin: 10px 0"></div>
                                        <?php if(is_array($childColumn) || $childColumn instanceof \think\Collection || $childColumn instanceof \think\Paginator): $i = 0; $__LIST__ = $childColumn;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                            <a href="<?php echo $v['url']; ?>" class="btn btn-success btn-sm"><?php echo $v['name']; ?></a>
                                        <?php endforeach; endif; else: echo "" ;endif; ?>
                                    </div>
                                </div>
                            </div>
                        <?php endif; ?>
                        <div class="row">
                            <div class="col-sm-12 m-b-xs">
                                <div class="btn-group">
                                    <a href="javascript:;" data-url="<?php echo url('admin/article/deleteArticle'); ?>" class="btn btn-danger batchDelete">
                                       <i class="glyphicon glyphicon-remove-circle"></i> 批量删除
                                    </a>
                                    <a href="javascript:;" data-url="<?php echo url('admin/article/articleSort'); ?>" class="btn btn-success batchUpdate">
                                       <i class="glyphicon glyphicon-align-left"></i> 更新排序
                                    </a>
                                    <a href="<?php echo url('admin/article/recycleBin',['column_id'=>$column_id]); ?>" class="btn btn-white">
                                        <i class="glyphicon glyphicon-trash"></i>    回收站
                                    </a>
                                    <a href="javascript:;" data-url="<?php echo url('admin/article/move'); ?>" class="btn btn-warning move">
                                        <i class="glyphicon glyphicon-move"></i>  移动
                                    </a>
                                    <a href="<?php echo url('admin/article/createArticle',['column_id'=>$column_id]); ?>" class="btn btn-info btn-rounded">
                                        <i class="glyphicon glyphicon-plus-sign"></i> 新增
                                    </a>
                                </div>
                            </div>
                        </div>

                        <div class="table-responsive">
                            <table class="table table-striped">
                                <thead>
                                <tr>

                                    <th><input type="checkbox" id="checkAll" class="i-checks"></th>
                                    <th>序</th>
                                    <th>标题</th>
                                    <th>分类</th>
                                    <th>点击数</th>
                                    <th>排序</th>
                                    <th>发布时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <?php if(!(empty($articleList) || (($articleList instanceof \think\Collection || $articleList instanceof \think\Paginator ) && $articleList->isEmpty()))): if(is_array($articleList) || $articleList instanceof \think\Collection || $articleList instanceof \think\Paginator): $i = 0; $__LIST__ = $articleList;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;?>
                                        <tr>
                                            <td>
                                                <input type="checkbox" value="<?php echo $v['article_id']; ?>"  class="i-checks" name="article_id[]">
                                            </td>
                                            <td><?php echo $i; ?></td>
                                            <td><?php echo $v->title; ?></td>
                                            <td><?php echo $v->column_model->name; ?></td>
                                            <td><?php echo $v->click; ?></td>

                                            <td><input type="text" class="form-control sortInput" name="sort[<?php echo $v['article_id']; ?>]" style="width: 50px;" value="<?php echo $v->sort; ?>"></td>
                                            <td><?php echo $v->release_time; ?></td>
                                            <td>
                                                <a href="<?php echo url('admin/article/editArticle',['article_id'=>$v['article_id']]); ?>" class="btn btn-warning btn-sm">
                                                    <i class="glyphicon glyphicon-edit"></i> 编辑
                                                </a>
                                                <a href="<?php echo url('admin/article/deleteArticle',['article_id'=>$v['article_id']]); ?>" class="btn btn-danger btn-sm">
                                                   <i class="glyphicon glyphicon-remove-circle"></i> 删除
                                                </a>
                                            </td>
                                        </tr>
                                    <?php endforeach; endif; else: echo "" ;endif; else: ?>
                                    <tr>
                                        <td colspan="8" align="center">暂无数据!</td>
                                    </tr>
                                <?php endif; ?>

                                </tbody>
                            </table>
                        </div>
                        <?php if(!(empty($articleList) || (($articleList instanceof \think\Collection || $articleList instanceof \think\Paginator ) && $articleList->isEmpty()))): ?>
                            <?php echo $articleList->render(); endif; ?>
                    </div>
                </div>
            </div>

        </div>
    </div>

<!-- jquery-->
<script src="__admin__/js/jquery.min.js"></script>
<!-- bootstarp-->
<script src="__admin__/js/bootstrap.min.js"></script>

    <!--美化 checkbox radio js-->
    <script src="__admin__/js/plugins/iCheck/icheck.min.js"></script>
    <!-- sweetalert js -->
    <script src="__admin__/js/plugins/sweetalert/sweetalert.min.js"></script>
    <script>
        $(document).ready(function(){
            $(".i-checks").iCheck({
                checkboxClass:"icheckbox_square-green",
                radioClass:"iradio_square-green",
            });
            $('#checkAll').on('ifChecked', function(event){
                $('.i-checks').iCheck('check');
            });
            $('#checkAll').on('ifUnchecked', function(event){
                $('.i-checks').iCheck('uncheck');
            });
            $('.batchDelete').on('click',function () {
                var content = $('.table td .i-checks:input:checked');
                if(content.length > 0) {
                    var url = $(this).data('url');
                    $.get(url, content.serialize(), function (data) {
                        swal({title: data.msg, icon: data.code?'success':'warning',dangerMode: true,}).then(function () {
                            location.reload(true)
                        });
                    }, 'json');
                }else{
                    swal({title: '请进行勾选!', icon: "warning",dangerMode: true,})
                }
            });
            $('.move').on('click',function () {
                var content = $('.table td .i-checks:input:checked');
                if(content.length > 0) {
                    var url = $(this).data('url')+'?'+content.serialize();
                    location.href   =   url;
                }else{
                    swal({title: '请进行勾选!', icon: "warning",dangerMode: true,})
                }
            });
            $('.batchUpdate').on('click',function () {
                var sortInput   =   $('.table td .sortInput:input');
                if(sortInput.length > 0){
                    var url = $(this).data('url');
                    $.get(url, sortInput.serialize(), function (data) {
                        swal({title: data.msg, icon: data.code?'success':'warning',dangerMode: true,}).then(function () {
                            location.reload(true)
                        });
                    }, 'json');
                }else{
                    swal({title: '当前没有数据无法排序呢!', icon: "warning",dangerMode: true,})
                }
            });
        });
    </script>

</body>
</html>
